home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Capture the Power of the Internet
/
Capture the Power of the Internet.iso
/
mac
/
MacFiles
/
System
/
Calculators
/
mathpad.sit
/
MathPad 2.5.2
/
Examples
/
solve
/
solve
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
Text File
|
1995-04-29
|
397 b
|
24 lines
|
[
TEXT/MPad
]
-- Solution of a system of equations by Cramers rule.
include ":incl:solver"
-- example system of equations
-- 2x + y + z = 2
-- x - y + 5z = 4
-- y - z = 8
A={{ 2, 1, 1}, -- coefficients
{ 1,-1, 5},
{ 0, 1,-1}}
C= { 2, 4, 8} -- constants
solve(A,C):{-8.0,13.0,5.0}
x=solve(A,C)[1]
y=solve(A,C)[2]
z=solve(A,C)[3]
2*x + y + z:2.0
x - y + 5*z:4.0
y - z:8.0